package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 通知渠道
 *
 * @author wuliepeng
 * @date 2019-07-11
 */
public enum NoticeChannelEnum {

    /**
     *
     */
    SYSTEM_NOTICE("SYSTEM", "系统通知"),

    DING_DING("DINGDING", "钉钉"),

    sms("SMS", "短信"),

    mail("MAIL", "邮件"),

    police_service("POLICE_SERVICE", "警务通");

    private String code;

    private String description;

    private static Map<String, String> codeToDesc = new HashMap<>();

    static {
        Arrays.asList(values()).forEach(item -> codeToDesc.put(item.getCode(), item.getDescription()));
    }

    NoticeChannelEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String getDescrByCode(String code) {
        return codeToDesc.get(code);
    }

    public static Map<String, String> getCodeToDesc() {
        return codeToDesc;
    }

    public static void setCodeToDesc(Map<String, String> codeToDesc) {
        NoticeChannelEnum.codeToDesc = codeToDesc;
    }

}
